import pyautogui as pg
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)

class Alert():
    def alert_window(self, msg):
        pg.alert(msg, 'Test')
        pass
    pass

class TestNode():
    def test_node(self, node):
        if node.exists():
            length_self = len(node)
            print('[+] node-length = {}'.format(length_self))
            if length_self > 1:
                for i in node:
                    i.swipe([0.1,0.1])
            else:
                node.swipe([0.1, 0.1])
            length_child = len(node.child())
            print('[+] node-length = {}'.format(length_child))
            if node.child().exists():
                for i in node.child():
                    i.swipe([0.1,0.1])
        else:
            print('no existing')

    def simple_test_node(self, node):
        if node.exists():
            node.swipe([0.1,0.1])

    def test_nodes(self, nodes):
        for i in nodes:
            print('[!]', str(i))
            self.test_node(i)
            x = input('[?] continue.')